#ifndef GAMEWINDOW_H
#define GAMEWINDOW_H

#include <QMainWindow>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QTimer>
#include <QKeyEvent>
#include <QGraphicsPixmapItem>

class Player;

class GameWindow : public QMainWindow {
    Q_OBJECT
public:
    explicit GameWindow(QWidget *parent = nullptr);
    void keyPressEvent(QKeyEvent *event) override;

private slots:
    void updateGame();

private:
    QGraphicsScene *scene;
    QGraphicsView *view;
    Player *player;
    QTimer *timer;
    int score;
    bool isGameOver;
    void spawnObstacle();
    void checkCollision();
    void gameOver();
    void resetGame();
};

class Player : public QGraphicsPixmapItem {
public:
    explicit Player(QGraphicsItem *parent = nullptr);
    void jump();
    void updatePosition();
    bool isJumping;
    double velocity;
    int jumpCount;
    int maxJumpCount;
};

#endif // GAMEWINDOW_H
